package com.huang.entity;

import java.io.Serializable;
import java.util.List;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.huang.validation.SaveGroupInterface;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * @author han
 * @since 2022-01-16 18:28:48
 */
@Data
@NoArgsConstructor
@TableName("sys_user")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class UserPo extends BaseEntity implements Serializable {

	private static final long serialVersionUID = -2500474242044077680L;

	/**
	 * 展示姓名
	 */
	@TableField("nick_name")
	@NotBlank(message = "用户名称不能为空")
	private String nickName;

	/**
	 * 展示姓名
	 */
	@TableField("username")
	@NotBlank(message = "用户名称不能为空")
	private String username;

	/**
	 * 手机号
	 */
	@TableField("phone")
	@NotBlank(message = "手机号码不能为空")
	@Pattern(regexp = "(?:0|86|\\+86)?1[3456789]\\d{9}", message = "手机格式不正确")
	private String phone;

	/**
	 * 短信验证码
	 */
	@TableField("auth_code")
	private String authCode;

	/**
	 * 密码盐
	 */
	@TableField("salt")
	@NotNull(groups = {SaveGroupInterface.class}, message = "密码盐不能为空")
	private String salt;

	/**
	 * 密码
	 */
	@TableField("password")
	@NotNull(groups = {SaveGroupInterface.class}, message = "密码不能为空")
	private String password;

	/**
	 * 登录IP
	 */
	@TableField("login_ip")
	private String loginIp;

	/**
	 * 登录时间
	 */
	@TableField("login_date")
	private Long loginDate;

	/**
	 * 0: 启用 1：删除
	 */
	@TableField("status")
	private Integer status;

	/**
	 * 角色id集合
	 */
	@TableField(exist = false)
	private List<String> roleIds;

	/**
	 * 用户头像
	 */
	private String avatar;
}
